﻿@model Tuple<List<LCTMoodle.Models.ViewModels.BaiVietViewModel>, int>

@{
    List<LCTMoodle.Models.ViewModels.BaiVietViewModel> baiViet = Model.Item1;
    int maKhoaHoc = Model.Item2;

    string quyen = ((Dictionary<int, string>)Session["Quyen"])[maKhoaHoc];

    bool coTheTaoBaiGiang = quyen.IndexOf("|4|") != -1;
}

@for (int i = 0; i < baiViet.Count; i++)
{
    <article class="article">
        <input class="ma-bai-viet" type="hidden" value="@baiViet[i].ma" />
        <section class="action-button">
            <i class="pe-7s-config"></i>
            <ul>
                @if(coTheTaoBaiGiang)
                {
                    <li>
                        <a class="giam-thu-tu" href="/BaiViet/GiamThuTu/@baiViet[i].ma">
                            Lên
                        </a>
                    </li>
                    <li>
                        <a class="tang-thu-tu" href="/BaiViet/TangThuTu/@baiViet[i].ma">
                            Xuống
                        </a>
                    </li>
                    <li>
                        <a class="sua-bai-viet" href="#">
                            Sửa bài viết
                        </a>
                    </li>  
                    <li>
                        <a class="xoa-bai-viet" href="/BaiViet/XoaBaiViet/@baiViet[i].ma">
                            Xóa bài viết
                        </a>
                    </li>
                }
            </ul>
        </section>
        <h3 class="article-title tieu-de" data-time="@baiViet[i].thoiGian">
            <i></i>
            <span>@baiViet[i].tieuDe</span>
        </h3>
        <section class="article-content-container">
            <div class="content noi-dung">
                @Html.Raw(baiViet[i].noiDung)
            </div>
            @if(baiViet[i].maTapTin != 0)
            {
                <div class="file">
                    <a href="/TapTin/KhoaHoc_Nhom_TapTin/@baiViet[i].maTapTin" class="show-file-button">
                        <i class="pe-7s-paperclip"></i>
                        <span>Xem tập tin đính kèm</span>
                    </a>
                </div>
            }
        </section>
    </article>
}